package github.sf.fw.tools.db;


import github.sf.fw.tools.db.model.ResultRow;
import github.sf.fw.tools.db.model.TableDataWithPage;
import github.sf.fw.tools.db.model.TableInfo;
import java.sql.SQLException;
import java.util.List;
import java.util.function.Consumer;

/**
 * 加载数据表中的数据
 *
 * @author zhoup
 */
public interface TableDataReader {
    TableDataWithPage loadTableData(TableInfo tableInfo, int page, int size) throws SQLException;

    TableDataWithPage loadTableDataWithScript(String queryScript, int page, int size) throws SQLException;

    List<ResultRow> loadTableData(TableInfo tableInfo) throws SQLException;

    List<ResultRow> loadTableDataWithScript(String querySql) throws SQLException;

    default void transfer(TableInfo tableInfo, Consumer<List<ResultRow>> dataConsumer) throws SQLException {
        throw new UnsupportedOperationException(String.format("%s暂不支持数据传输", this.getClass()));
    }


}
